# frozen_string_literal: true

require "bundler/gem_tasks"
require "vagrant"

task default: %i[]
CLEAN.include("pkg/*")

namespace :vagrant do
  desc "vagrant uninstall"
  task :uninstall do
    `vagrant plugin uninstall vagrant-luccych-helloworld`
  end

  desc "vagrant install"
  task install: ["vagrant:uninstall", :clean, :build] do
    require_relative "lib/vagrant/luccych/helloworld/version"
    sh_script = %(
                vagrant plugin install\
                ./pkg/vagrant-luccych-helloworld-#{Vagrant::Luccych::HelloWorld::VERSION}.gem\
                --plugin-clean-sources
            )
    sh sh_script
  end
end

namespace :git do
  desc "git commit"
  task :commit do
    sh_script = %(
            git add .
            git commit -m "rake update"
            git push
        )
    sh sh_script
  end
end
